import  java.util.*;
public class TestDemo6B {
    public static void main(String[]args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        int count = 0;
        int j = 0;
        while (j < n - 1) {
            if (j < n - 1 && nums[j] < nums[j + 1]) {
                while (j < n - 1 && nums[j] < nums[j + 1]) {
                    j++;
                }
                count++;
                j++;
            } else if (j < n - 1 && nums[j] == nums[j + 1]) {
                j++;
            } else {
                while (j < n - 1 && nums[j] > nums[j + 1]) {
                    j++;
                }
                count++;
                j++;
            }
        }
        System.out.println(count);
    }
}
class Main3 {
    public static void reverse(int left, int right, char[] ch) {
        while (left < right) {
            char tem = ch[left];
            ch[left] = ch[right];
            ch[right] = tem;
            left++;
            right--;
        }
    }

    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        char[] ch = str.toCharArray();
        int left = 0;
        int right = str.length() - 1;
        reverse(left, right, ch);
        int n = ch.length;
        int i = 0;
        int j = 0;
        while (i < n) {
            if (j < n && ch[j] != ' ') {
                while (j < n && ch[j] != ' ') {
                    j++;
                }
            } else {
                if (j < n) {
                    reverse(i, j - 1, ch);
                    i = j + 1;
                    j = i;
                } else {
                    reverse(i, j - 1, ch);
                    i = j;

                }
            }
        }
        String tem = new String(ch);
        System.out.println(tem);
    }

    public static void main6(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n + 1];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        int count = 0;
        int j = 0;
        while (j < n) {
            if ( nums[j] < nums[j + 1]) {
                while (j < n  && nums[j] < nums[j + 1]) {
                    j++;
                }
                j++;
                count++;
            } else if ( nums[j] == nums[j + 1]) {
                j++;
            } else {
                while (j < n && nums[j] > nums[j + 1]) {
                    j++;
                }
                j++;
                count++;
            }
        }
        System.out.println(count);
    }

    public static void main4(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[]array=new int[m+1];
        for(int i=0;i<m+1;i++){
            array[i]=0;
        }
        for(int i=n;i<m;i++){
            List<Integer>list=div(i);
            for(int x:list){
                if(i+x<=m&&array[i+x]!=0){
                    array[i+x]=Math.min(array[i+x],array[i]+1);
                }
                else if(i+x<=m){
                    array[i+x]=array[i]+1;
                }
            }
        }
        if(array[m]==0){
            System.out.println(-1);
        }
        else{
            System.out.println(array[m]);
        }
    }
    public static List<Integer>div(int x){
        ArrayList<Integer>list=new ArrayList<>();
        for(int i=2;i<x;i++){
            if(x%i==0){
                list.add(i);
            }
        }
        return list;
    }

    public static void main7(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        char[]array=str.toCharArray();
        int count=0;
        for(int i=0;i< array.length;i++){
            if(array[i]=='"'){//移到的是""里面的下标(且里面的空格不算)
                do{
                    i++;
                }while(array[i]!='"');
            }
            else if(array[i]==' '){
                count++;
            }
        }
        System.out.println(count+1);//整体字符数等于空格数+1
        int flag=1;//flag的目的是为了计算 ""里面的情况
        for(int i=0;i< array.length;i++){
            if(array[i]=='"'){//1表示在""外面,0表示在""里面
                flag^=1;
            }
            if(array[i]!='"'&&array[i]!=' '){//字符串不要空格,也不要""
                System.out.print(array[i]);
            }else if(array[i]==' '&&flag==1){//如果是""外的空格就需要换行
                System.out.println();
            }
            else if(array[i]==' '&&flag==0){//双引号内的空格要加上
                System.out.print(' ');
            }
        }
    }

    public static void main8(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int []array=new int [m+1];
        for(int i=0;i< array.length;i++){
            array[i]=Integer.MAX_VALUE;
        }
        array[n]=0;
        for(int i=n;i<=m;i++){
            if(array[i]==Integer.MAX_VALUE){//代表着没跳过的石板,然后直接跳过本次循环
                continue;
            }
            List<Integer>list=divs(i);//满足该石板的公约数
            for(int j:list){
                //跳过一次的情况,就需要判断该石板的最少跳的次数
                if(i+j<=m&&array[i+j]!=Integer.MAX_VALUE){
                    array[i+j]=Math.min(array[i+j],array[i]+1);
                }else if(i+j<=m){//第一次跳入该石板
                    array[i+j]=array[i]+1;
                }
            }
        }
        if(array[m]==Integer.MAX_VALUE){//不满足的情况
            System.out.println(-1);
        }
        else{
            System.out.println(array[m]);
        }
    }

    private static List<Integer>divs(int x) {
        List<Integer>list=new ArrayList<>();
        for(int i=2;i*i<=x;i++){
            if(x%i==0){
                list.add(i);
                if(x/i!=i){
                    list.add(x/i);
                }
            }
        }
        return list;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.next();
        String str2 = sc.next();
        int count = 0;
        for(int i=0;i<=str1.length();i++){
            StringBuffer sb=new StringBuffer(str1);
            sb.insert(i,str2);
            StringBuffer tem=new StringBuffer(sb);
            StringBuffer str4=tem.reverse();
            if(str4.toString().equals(sb.toString())){
                count++;
            }
        }
        System.out.println(count);
    }
}